package util;


import java.util.HashMap;
import java.util.LinkedHashMap;
public class Info {
   
    private final static HashMap<String,LinkedHashMap<String,Description>> descriptions;
    
    static {
        descriptions = new HashMap<>();
      
        LinkedHashMap<String,Description> adminUserDescriptions = new LinkedHashMap<>();
        adminUserDescriptions.put("getLogin",new Description(0,"Login",String.class));
        adminUserDescriptions.put("getPassword", new Description(1,"Password",String.class));
        adminUserDescriptions.put("getUserGroup", new Description(2,"User group",String.class));
        adminUserDescriptions.put("getFirstName", new Description(3,"First name",String.class));
        adminUserDescriptions.put("getSecondName", new Description(4,"Second name",String.class));
        adminUserDescriptions.put("getPhone", new Description(5,"Phone",String.class));
        adminUserDescriptions.put("getEmail", new Description(6,"Email",String.class));
        
        descriptions.put("class entities.users.AdminUser",adminUserDescriptions);
    }

    public static boolean descriptionExist(Class<?> c,String setterName){
        if(!descriptions.containsKey(c.toString())){
            return false;
        }
        if(!descriptions.get(c.toString()).containsKey(setterName)){
            return false;
        }
        if(descriptions.get(c.toString()).get(setterName)==null){
            return false;
        }
        return true;
    }
    
    public static String getDescription(Class<?> c,String setterName) {
        System.out.println("TEST:"+c.toString()+":"+setterName);
        return descriptions.get(c.toString()).get(setterName).getDescription();
    }
    
    
    public static int getOrder(Class<?> c,String setterName){
        return descriptions.get(c.toString()).get(setterName).getOrder();
    }

    public static Class<?> getType(Class<?> c,String setterName){
        return descriptions.get(c.toString()).get(setterName).getType();
    }
    
    public static LinkedHashMap<String,Description> getDescriptions(Class<?> c){
       return descriptions.get(c.toString());
    }
}
